﻿using System.IO;
using System.Text.RegularExpressions;

namespace Axiom.CodeManifold
{
	public static class stringExtensions
	{
		public static string SplitPascalCase(this string value)
		{
			string result = null;

			if (string.IsNullOrWhiteSpace(value))
			{
				return string.Empty;
			}
			Regex regex = new Regex(@"(?<!^)([A-Z][a-z]|(?<=[a-z])[A-Z])", RegexOptions.Compiled);
			result = regex.Replace(value.Replace("_",""), " $1").Trim();

			return result;
		}

		public static string ReadLine(this string value)
		{
			var line = string.Empty;
			using (var sr = new StringReader(value))
			{
				line = sr.ReadLine();
			}
			return line;
		}
	}
}
